package src.lab03.test05;

import java.io.*;

/**
 * Created by 阿阿阿阿豪丶 on 2017/12/15.
 */
public class Test {
    public static void main(String[] args) {
        String path = "D:/Book.txt";
        BufferedReader reader = null;
        BufferedWriter writer = null;
        try {
            reader = new BufferedReader(new FileReader(path));
            writer = new BufferedWriter(new FileWriter(path));

            String line = null;
            while ((line = reader.readLine())!= null){
                System.out.println(line);

                writer = new BufferedWriter(new FileWriter(path));
                byte[] bytes = line.getBytes();
                char[] chars = new char[bytes.length];
                for (int i = 0; i < bytes.length; i++) {
                    bytes[i] += 1;
                    chars[i] = (char) bytes[i];
                }
                writer.write(chars);}
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                reader.close();
                writer.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}
